<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生信息管理系统登录</title>
    <script src="js/vue2.js"></script>
    <script src="js/axios.js"></script>
    <style>
        #app{
            border:solid 8px lightblue;
            margin:0 auto;
            width:800px;
            background:lightgoldenrodyellow;
            text-align:center;
        }
        #app input{
            margin:20px;
            border:2px blue;
            border-radius:30px;
            border:solid 5px lightgreen;
        }
    </style>
</head>
<body>
<div id="app">
    <div id="box">
        <form @submit.prevent="login">
            账户：<input type="text" v-model="form.admin"><br>
            密码：<input type="password" v-model="form.password"><br>
            <button>登录</button>
        </form>
    </div>
</div>
<script>
    new Vue({
        el:"#app",
        data:{
            form:{
                admin:'',
                password:''
            }
        },
        methods:{
            login(){
                axios.post('http://localhost:8080/isAdmin',this.form).then(
                    response=>{
                        if(response.data.data!=null){
                            window.location.href="myPage.html";
                        }else{
                            alert("用户名或密码错误！")
                        }
                    }
                )
            }
        }

    })
</script>
</body>
</html>